﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Barbar.MapReport.Common.Drawing {
  [Serializable]
  public class PolygonBehaviorBubble : PolygonBehavior {
    private string m_DescriptionTemplate;

    public PolygonBehaviorBubble(string descriptionTemplate) {
      if (String.IsNullOrEmpty(descriptionTemplate))
        throw new ArgumentNullException("descriptionTemplate");
      m_DescriptionTemplate = descriptionTemplate;
    }

    public string GetDescription(string toolTip, string polygonName) {
      if (String.IsNullOrEmpty(m_DescriptionTemplate))
        return toolTip;

      string result = m_DescriptionTemplate;
      result = result.Replace("{Content}", toolTip);
      result = result.Replace("{Name}", polygonName);
      return result;
    }

    public string DescriptionTemplate {
      get { return m_DescriptionTemplate; }
      set { m_DescriptionTemplate = value; }
    }
  }
}
